package com.itqf.sms.controller;

import com.itqf.sms.dto.BillDto;
import com.itqf.sms.pojo.Bill;
import com.itqf.sms.service.BillService;
import com.itqf.sms.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * projectName: springboot_part
 *
 * @author: 赵伟风
 * time: 2021/9/23 15:09
 * description:账单模块的controller类
 */
@RestController
@CrossOrigin("*")
@RequestMapping("bill")
public class BillController {

    @Autowired
    private BillService billService;

    /**
     * 供应商的下拉列表展示
     * @return
     */
    @GetMapping("providers")
    public Object providers(){
        R r  = billService.providers();
        return r;
    }

    /**
     * 查询账单列表和模糊查询账单列表
     * @param billDto
     * @return
     */
    @GetMapping("list")
    public Object list(BillDto billDto){
        R r = billService.list(billDto);
        return r;
    }

    /**
     * 添加账单数据
     * @param bill
     * @return
     */
    @PostMapping("save")
    public Object save(@RequestBody Bill bill){
        R r = billService.save(bill);
        return r;
    }

    /**
     * 修改账单数据
     * @param bill
     * @return
     */
    @PostMapping("update")
    public Object update(@RequestBody Bill bill){
        R r = billService.update(bill);
        return r;
    }

    /**
     * 删除账单接口
     * @param bid
     * @return
     */
    @GetMapping("delete")
    public Object delete(int bid){
        R r = billService.delete(bid);
        return r;
    }


}
